#{{ ansible_managed }}

WSGISocketPrefix /var/run/retrace
WSGIDaemonProcess retrace user=retrace group=retrace processes=5 threads=3

WSGIScriptAliasMatch ^/manager(/.*)?$ /usr/share/retrace-server/manager.wsgi
WSGIScriptAliasMatch ^/ftp(/.*)?$ /usr/share/retrace-server/ftp.wsgi
WSGIScriptAliasMatch ^/settings$ /usr/share/retrace-server/settings.wsgi
WSGIScriptAliasMatch ^/create$ /usr/share/retrace-server/create.wsgi
WSGIScriptAliasMatch ^/stats$ /usr/share/retrace-server/stats.wsgi
WSGIScriptAliasMatch ^/checkpackage$ /usr/share/retrace-server/checkpackage.wsgi
WSGIScriptAliasMatch ^/[0-9]+/?$ /usr/share/retrace-server/status.wsgi
WSGIScriptAliasMatch ^/[0-9]+/delete$ /usr/share/retrace-server/delete.wsgi
WSGIScriptAliasMatch ^/[0-9]+/log$ /usr/share/retrace-server/log.wsgi
WSGIScriptAliasMatch ^/[0-9]+/backtrace$ /usr/share/retrace-server/backtrace.wsgi
WSGIScriptAliasMatch ^/[0-9]+/exploitable$ /usr/share/retrace-server/exploitable.wsgi
WSGIScriptAliasMatch ^/[0-9]+/start$ /usr/share/retrace-server/start.wsgi
WSGIScriptAliasMatch ^/$ /usr/share/retrace-server/index.wsgi

<Directory "/var/cache/retrace-server">
    Options Indexes FollowSymLinks
    AllowOverride None
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from all
    </IfModule>
</Directory>

<LocationMatch "^/(manager(/.*)?|ftp|settings|create|stats|checkpackage|[0-9]+(/(log|backtrace|delete|exploitable))?)?$">
    WSGIProcessGroup retrace
    Options -Indexes -FollowSymLinks
    <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order allow,deny
        Allow from all
    </IfModule>
</LocationMatch>

Alias /repos /var/cache/retrace-server
